//
//  ViewController.swift
//  MVVM_BaseViewController_Demo
//
//  Created by 钟志远 on 2018/1/3.
//  Copyright © 2018年 alyadan. All rights reserved.
//

import UIKit
import MVVM_BaseViewController
import QMUIKit

class AViewController: MVVM_BaseViewController{

    
    override var currentModel: AVCModel {
       return vcModel.value as! AVCModel
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.vcModel.value = AVCModel()
        setNavgationItem(withImageName: nil, orTitle: "next")
        // Do any additional setup after loading the view, typically from a nib.
    }

    @IBAction func btnClicked(_ sender: Any) {
        
        let model = VCModelB(parentViewModel: self.currentModel)
        navigationController?.pushVcModel(vcModel: model)
    }
    
//    override func preferredNavigationBarHidden() -> Bool {
//        return true
//    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func navigationBarBackgroundImage() -> UIImage? {
        return UIColor.createImage(color: UIColor.blue, size: CGSize.init(width: 10, height: 10))
    }

}

class AVCModel: MVVM_BaseVCModel {
    override func viewController(vcIndex: Int) -> MVVM_BaseViewController? {
        return AViewController()
    }
    
    override func setupModel() {
       viewControllerTitle.value = "test"
    }
    
    override func bindDataModel() {
        print("bindDataModel")
    }
    
}

